package com.ftg.learn.framework.spring.chapter04.local.xml;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 布衣
 */
public class SpringXmlLearn {

    public static void main(String[] args) {
        //1 在配置文件里面声明当前类

        //2 加载配置文件
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");
        Object obj = applicationContext.getBean("product");
        Product pro = (Product)obj;
        System.out.println(pro.getName());
        System.out.println(pro.getFarmer().getName());
    }

}
